Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Import notes' images from revoked sharings #4339

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

taratatach
Copy link
Member

@taratatach taratatach commented Feb 26, 2024

The io.cozy.notes.images documents associated with a Cozy Note are
not shared with the note itself.
Therefore, when the sharing is revoked and the note opened by the
sharing recipient on their own Cozy (i.e. shared notes are opened on
their creator's Cozy while the sharing is active), included images are
shown as missing because we can't find their associated
io.cozy.notes.images documents.

However, the image binaries themselves are stored wihtin the note's
binary (which is an archive in this case) and thus can be imported on
the recipient's Cozy as io.cozy.notes.images documents and the note
content can be updated to reference these documents.
After that, the images will be displayed as expected when opening the
note.

@taratatach taratatach force-pushed the fix/import-revoked-shared-notes-images branch from 94302af to 617580c Compare February 27, 2024 11:05
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Outdated Show resolved Hide resolved
model/sharing/open_note.go Outdated Show resolved Hide resolved
model/sharing/open_note.go Outdated Show resolved Hide resolved
model/sharing/open_note.go Show resolved Hide resolved
  We'll want to add dependencies to the `note` model package in the
  `sharing` model package so we can't have existing dependencies the
  other way around or we'll end up with circular dependencies.
@taratatach taratatach force-pushed the fix/import-revoked-shared-notes-images branch from 617580c to 4fc0d3c Compare February 27, 2024 14:55
  Move the last implementation of `sharing.FileOpener` to the `sharing`
  model package now that we've moved the note opening logic to this
  package.
@taratatach taratatach force-pushed the fix/import-revoked-shared-notes-images branch from 4fc0d3c to 3cb3a85 Compare February 27, 2024 15:10
@taratatach taratatach marked this pull request as ready for review February 27, 2024 15:10
@taratatach taratatach requested a review from a team as a code owner February 27, 2024 15:10
@taratatach taratatach changed the title WIP: import images from notes (circular dependencies) fix: Import notes' images from revoked sharings Feb 27, 2024
model/note/import.go Outdated Show resolved Hide resolved
model/note/import.go Show resolved Hide resolved
@taratatach taratatach force-pushed the fix/import-revoked-shared-notes-images branch from 3cb3a85 to ef24a76 Compare February 27, 2024 15:42
  The `io.cozy.notes.images` documents associated with a Cozy Note are
  not shared with the note itself.
  Therefore, when the sharing is revoked and the note opened by the
  sharing recipient on their own Cozy (i.e. shared notes are opened on
  their creator's Cozy while the sharing is active), included images are
  shown as missing because we can't find their associated
  `io.cozy.notes.images` documents.

  However, the image binaries themselves are stored within the note's
  binary (which is an archive in this case) and thus can be imported on
  the recipient's Cozy as `io.cozy.notes.images` documents and the note
  content can be updated to reference these documents.
  After that, the images will be displayed as expected when opening the
  note.
  Don't wait until the user tries to open a note from a revoked sharing
  to recreate its trigger but do it instead upon the sharing revocation.
@taratatach taratatach force-pushed the fix/import-revoked-shared-notes-images branch from ef24a76 to 768c08d Compare February 28, 2024 08:51
@taratatach taratatach merged commit f932cad into master Feb 28, 2024
4 checks passed
@taratatach taratatach deleted the fix/import-revoked-shared-notes-images branch February 28, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants